/**
* @file kinematics_crc16.h
*
* Copyright(c) 2016-2019, MicroPort Scientific Corporation. All rights reserved. \n
* Description: This file is used for kinematic parameter configuration verification \n
*              and torque control command verification. \n
* Platform: Beckhoff/STM32F406. \n
* Polynomial: Special. \n
* Author: Monday \n
* Create: 2017-09-15 00:03:57
*/
#ifndef __KINEMATICS_CRC16_H__
#define __KINEMATICS_CRC16_H__



#define CRC_FALSE   0
#define CRC_TURE    1


/**
 * @brief  crc16 calculation, the last two bytes are not calculated by default
 * @param  data [IN] Source data pointer
 * @param  len [IN] The length of the data to be sent, including crc16
 * @retval Crc16, and the high and low byte have been swapped
 * @attention This function does not make a null pointer and length judgment. 
 *            The caller needs to ensure that the DATA pointer is not null 
 *            and LEN is greater than or equal to 2.
 */
extern unsigned short crc_cal(void *data, unsigned int len);

/**
 * @brief  Verify that the crc is correct.
 * @param  data [IN] Source data pointer
 * @param  len [IN] The length of the data to be sent, including crc16
 * @retval #CRC_FALSE - crc verification failed
 *         #CRC_TURE  - crc verification succeeded
 * @attention This function does not make a null pointer and length judgment. 
 *            The caller needs to ensure that the DATA pointer is not null 
 *            and LEN is greater than or equal to 2.
 */
extern int crc_check(void * data, int len);




#endif//__KINEMATICS_CRC16_H__